/******************************************************************************
** $Id: dc_soc_util_api.h,v 1.1.1.1 2009-02-13 22:36:43 beliloi Exp $
**                 Proprietary and Confidential Information                  **
**                                                                           **
**                 Copyright (c) SigmaTel, Inc. Unpublished                  **
**                                                                           **
** This source code and the algorithms implemented therein constitute        **
** confidential information and may compromise trade secrets of SigmaTel,    **
** Inc. or its associates, and any unauthorized use thereof is prohibited.   **
**                                                                           **
******************************************************************************/
#ifndef _dc_soc_util_h_
# define _dc_soc_util_h_
/**************************************************************************//**
*  @file dc_util.h
*  @brief This file contains the API for SOC utilities. Please refer
*  to the Operating Environment reference manual for details.
******************************************************************************/
/******************************************************************************
*  FILE FORMAT: <PUBLIC>
*      1. INCLUDES 
*      2. ENUMERATIONS 
*      3. DEFINES
*      4. STRUCTURES
*      5. GLOBALS
*      6. PUBLIC FUNCTION PROTOTYPES
******************************************************************************/
/******************************************************************************
*  1. INCLUDES
******************************************************************************/
/******************************************************************************
*  2. ENUMERATIONS
******************************************************************************/
typedef enum
{
    DC_OP_MODE_INIT,
    DC_OP_MODE_THREAD,
    DC_OP_MODE_IRQ,
    DC_OP_MODE_FIRQ,
    DC_OP_MODE_TIMER,
    DC_OP_MODE_TICK_HANDLER,
    DC_OP_MODE_UNKNOWN
} DC_OPERATING_MODE;

typedef enum
{
    DC_DEBUG_LOAD=0,
    DC_DEBUG_CLEAR=1,
    DC_DEBUG_SMALLBOOT=2,
    DC_DEBUG_COMPRESSED_FIRMWARE=3
} DC_DEBUG_MODE;
/******************************************************************************
*  3. DEFINES
******************************************************************************/
# define DC_DEBUG_MODE_SIZE 4
/******************************************************************************
*  4. STRUCTURES
******************************************************************************/
/******************************************************************************
*  5. GLOBALS
******************************************************************************/
/******************************************************************************
*  6. PUBLIC FUNCTION PROTOTYPES
******************************************************************************/
ARC_CC(_NEVER_RETURNS) void dc_reboot(int normal_boot);
UINT8 dc_reg_update(UINT32 address, UINT8 mask, char op);
int dc_memory_protection_enable(int enabled);
void dc_memory_protection_init(void);
DC_RETURN_CODE dc_memory_protection_delay_enable(boolean enabled);
boolean dc_memory_protection_check(boolean delay);
DC_OPERATING_MODE dc_operating_mode_get(void);
DC_RETURN_CODE dc_debug_mode_set(DC_DEBUG_MODE mode, 
                                 UINT32 (*pDetails)[DC_DEBUG_MODE_SIZE]);

/*
  This is declared as a weak function in dc_soc_util.c.  It is called in case
  of assertion failure, and might be used to display details on a UI, save
  a record to flash, &c.  It will be called with interrupts completely disabled,
  and dc_reboot will be called as soon as it returns.
*/
void dc_assert_failure_hook(char *what, char *filename, unsigned line);

#endif /*  _dc_soc_util_h_ */
